package com.tangmu.rabbits.ui.fragment.home;

import android.support.v4.content.ContextCompat;
import android.support.v7.widget.OrientationHelper;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.StaggeredGridLayoutManager;

import com.tangmu.rabbits.R;
import com.tangmu.rabbits.adapter.home.NineGoodsAdapter;
import com.tangmu.rabbits.adapter.optimization.ClassifyGoodsAdapter;
import com.tangmu.rabbits.base.BaseFragment;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

/**
 * 9块9包邮
 */
public class NineFragment extends BaseFragment {
    // TODO: Rename parameter arguments, choose names that match
    // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
    private static final String ARG_PARAM1 = "param1";
    private static final String ARG_PARAM2 = "param2";
    @BindView(R.id.nine_recyclerView)
    RecyclerView mRecyclerView;

    // TODO: Rename and change types of parameters
    private String mParam1;
    private String mParam2;
    private NineGoodsAdapter adapter;
    private List<Integer> datas = new ArrayList<>();

    public NineFragment() {
        // Required empty public constructor
    }

    @Override
    protected int getLayoutResource() {
        return R.layout.fragment_nine;
    }

    @Override
    protected void initView() {
        initDatas();
    }

    private void initDatas() {
        for (int i = 0; i < 10; i++) {
            datas.add(i);
        }

        mRecyclerView.setLayoutManager(new StaggeredGridLayoutManager(2, OrientationHelper.VERTICAL));
        //mRecyclerView.addItemDecoration(new com.tangmu.rabbits.widget.recycle.GridDividerItemDecoration(2, ContextCompat.getColor(getActivity(), R.color.line_e_color)));
        adapter = new NineGoodsAdapter(mActivity, datas);
        mRecyclerView.setAdapter(adapter);

    }

}
